Denizen Script Language Explanations


Language Explanations explain components of Denizen in a more direct and technical way than The Beginner's Guide.


Showing 1 out of 89 language explanations...
NameDialog Buttons
DescriptionButtons define interactive actions within dialogs.

Button sections depend on dialog type:

confirm dialog:
- yes:
- no:

notice dialog:
- button:

multi dialog:
- buttons:

Button fields:

- label: <text> (Required)
- tooltip: <text>
- width: <number>
- condition: <tag> (the button is only included when this returns 'true')
- type: SCRIPT, RUN_COMMAND, OPEN_URL, COPY_TO_CLIPBOARD

ACTION TYPES:

SCRIPT (default)
Runs a script block. A button with no 'script' section simply closes the dialog,
which is the usual case for an 'exit button'.
An 'exit button' can carry a 'script' section as well, which is what it takes to leave a dialog
whose 'base.after action' is 'none'.

Example:
script:
- narrate "Hello"

Available context values:
<context.button_id> returns the ID of the button clicked.
<context.namespace> returns the namespace of the dialog (e.g., 'denizen').
<context.inputs> returns a MapTag of all active input fields.
<context.[input_id]> returns the typed value of the specific input field directly.

Note that a button ID used with a script must be usable in a namespaced key. It is lowercased and
its spaces become underscores on the way there, so beyond letters, digits and spaces only the
'.', '_' and '-' symbols are allowed, and an 'exit button' arrives as 'exit_button' in
<context.button_id>.

RUN_COMMAND
Runs a command when clicked.
command: spawn

OPEN_URL
Opens a web URL.
url: https://example.com

COPY_TO_CLIPBOARD
Copies text to the player's clipboard.

text: Hello world
GroupScript Container System
Sourcehttps://github.com/MINEZ/Denizen/blob/dev/paper/src/main/java/com/denizenscript/denizen/paper/containers/DialogScriptContainer.java#L247